/*
 * basic.h
 *
 *  Created on: Apr 17, 2016
 *      Author: root
 */

#ifndef BASIC_H_
#define BASIC_H_

#include "ds.h"

#define ITEM_OPERATOR    0
#define ITEM_ARGUMENTS   1
#define ITEM_ENVIRONMENT 2
#define ITEM_CODE        3

int hash_fn(const char *key, int table_size);
void add_slot_by_symbol(Scheme *sc, Cell* vec, Cell* symbol, Cell* value);
void replace_slot_by_symbol(Scheme *sc, Cell* vec, Cell* symbol, Cell* value);
void delete_slot_by_symbol(Scheme *sc, Cell* vec, Cell* symbol);
Cell* find_slot_by_symbol(Scheme *sc, Cell* vec, Cell* symbol);
int cell_contains_element(Scheme *sc, Cell *cell, Cell *element);

char* cell2str(Scheme *sc, Cell* cell);

void push_callstack(Scheme *sc, Cell* op, Cell* args, Cell* code);
Cell* pop_callstack(Scheme *sc);
Cell* pick_current_item(Scheme *sc, int type);
Cell* pick_callstack_item(Scheme *sc, int type);

#endif /* BASIC_H_ */
